package cn.yi.boot.mq.coder;

import org.springframework.util.SerializationUtils;

public class SerialEncoderDecoder<T> implements MessageEncoder<T>,MessageDecoder<T> {
    @Override
    public byte[] encode(T message) {
        return SerializationUtils.serialize(message);
    }

    @Override
    public T decode(byte[] data) {
        return (T) SerializationUtils.deserialize(data);
    }
}
